package com.intramirror.product.utils;

import java.math.BigDecimal;

/**
 * Created on 2018/4/19.
 * @author 123
 */
public class ConvertUtil {

    public static Long toLong(Object o) {
        if (o == null) {
            return null;
        }

        return Long.valueOf(o.toString());
    }

    public static String toString(Object o) {
        if (o == null) {
            return null;
        }
        return o.toString();
    }

    public static BigDecimal toBigDecimal(Object o) {
        if (o == null) {
            return null;
        }
        return new BigDecimal(o.toString());
    }

    public static Integer toInteger(Object o) {
        if (o == null) {
            return null;
        }
        return Integer.valueOf(o.toString());
    }
}
